class HttpException extends Error {
    constructor(message = '', status = 500) {
        super(message);
        this.name = this.constructor.name;
        this.status = status;
    }


    setStatus(num) {
        this.status = num;
        return this;
    }

    setMsg(str) {
        this.message = str;
        return this;
    }

}


module.exports = {
    HttpException,
    error: (msg, code) => {
        throw new HttpException(msg,code);
    }
}
